Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move connectionset from analyzer and protocols from synthesizer #10

Merged
merged 20 commits into from
Mar 21, 2024

Conversation

elazarg
Copy link
Member

@elazarg elazarg commented Mar 6, 2024

Reopening #8.

Main differences from the version in the synthesizer:

  • Remove mutating methods, replace with convenience constructors: All(), None(), TCPorUDPConnection(), ICMPConnection()
  • Remove AllowAll field
  • Dedicated StatefulState type
  • Use netp.ProtocolString instead of ProtocolStr
  • switchSrcDstPortsOnTCP() only actually switch dimensions when they differ
  • Sort protocol strings lexicographically on output: ICMP,TCP,UDP
  • Rename:
    • ConnectionSet => Set
    • getProtocolStr() => protocolStringFromCode()
    • getDimensionDomain() => entireDimension()
    • AllowAll => IsAll()
    • Intersection() => Intersect()
    • ConnWithStatefulness() => WithStatefulness()
    • getDimensionStr() => getDimensionString()
    • Except() => ExceptCidrs()

@elazarg elazarg requested a review from adisos March 6, 2024 14:05
@adisos adisos requested a review from zivnevo March 7, 2024 06:48
Copy link
Contributor

@adisos adisos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link
Member

@zivnevo zivnevo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the copyright comment at the top for all source files

/*
Copyright 2020- IBM Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

Copy link
Contributor

@adisos adisos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Added just a small comment for now

pkg/connection/connectionset.go Outdated Show resolved Hide resolved
pkg/ipblock/ipblock.go Outdated Show resolved Hide resolved
pkg/ipblock/ipblock_test.go Outdated Show resolved Hide resolved
Elazar Gershuni added 3 commits March 19, 2024 12:51
@elazarg elazarg requested a review from adisos March 20, 2024 11:26
Elazar Gershuni added 2 commits March 20, 2024 13:31
Copy link
Contributor

@adisos adisos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! just one small comment

pkg/connection/connectionset.go Outdated Show resolved Hide resolved
Signed-off-by: Elazar Gershuni <[email protected]>
pkg/connection/connectionset.go Outdated Show resolved Hide resolved
pkg/interval/intervalset.go Show resolved Hide resolved
pkg/interval/intervalset.go Show resolved Hide resolved
pkg/hypercube/hypercubeset_test.go Outdated Show resolved Hide resolved
pkg/ipblock/ipblock.go Outdated Show resolved Hide resolved
Elazar Gershuni added 2 commits March 21, 2024 12:09
@elazarg
Copy link
Member Author

elazarg commented Mar 21, 2024

I realized that the dimension types encode the order of the dimensions, which makes it harder to know what depends on the order of the dimensions, and contradicts the comment preceding dimensionsList:

// this should be the only place where the order is hard-coded

So the last commit changes the type of Dimension from int to string; the index of each dimension in a cube is looked up in the slice dimensionsList. It also delegates most of the work of swapping dimensions to the underlying hypercube set.

@elazarg elazarg requested a review from zivnevo March 21, 2024 10:19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have an (exported?) global var here representing the full range of IP addresses?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea

Signed-off-by: Elazar Gershuni <[email protected]>
Signed-off-by: Elazar Gershuni <[email protected]>
@elazarg elazarg merged commit fc2b1ae into main Mar 21, 2024
4 checks passed
@elazarg elazarg deleted the connectionset-2 branch March 21, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants